var bo=document.querySelector("body")
var siteLoading=document.querySelector(".loading") 
setTimeout(function(){
	siteLoading.classList.remove('active')  
    bo.classList.remove('acive')
},2000)
window.onload=function(){ 
    let h1=document.querySelector(".myintro h1")
    h1.style.transform="translateY(0px)"
    let span=document.querySelectorAll(".myintro span")
    for(let i=0;i<span.length;i++){
        span[i].style.transform="translateY(0px)"
    }
}
$(function () {
        var cont=0;
        var font=$("#text").html();
        function run(){
          $("#show").html(font.substring(0,cont++));
        }
        setInterval(run, 100);
})
let bgli = document.querySelectorAll(".bg-img li") 
let s = 0;
setInterval(function () {
	s++;
	if (s <= 2) {
		for (let i = 0; i < bgli.length; i++) {
			bgli[i].classList.remove("show") 
		}
		bgli[s].classList.add("show")  
	}else{
		s=0;
		for (let i = 0; i < bgli.length; i++) {
			bgli[i].classList.remove("show") 
		}
		bgli[s].classList.add("show") 
	} 
}, 4000)

let ty = document.querySelector("#abt")
ty.addEventListener('click', function () {
    let ahu=document.querySelector(".about .box h1")
    let nv=document.querySelector(".about .box .xi")
    let nn=document.querySelector(".about .box .user img")
    let na=document.querySelector(".about .box p")
    ahu.classList.add("active") 
    nv.classList.add("active") 
    nn.classList.add("active") 
    na.classList.add("active") 
    let wid = window.innerHeight
    window.scrollTo({
        top: wid
        , behavior: 'smooth'
    })   
})
let ath = document.querySelector("#ath")
ath.addEventListener('click', function () {
    let ahu=document.querySelector(".athor .box h1")
    let nv=document.querySelector(".athor .box .xi") 
    ahu.classList.add("active") 
    nv.classList.add("active")  
    let wid = window.innerHeight
    window.scrollTo({
        top: 3*wid+100
        , behavior: 'smooth'
    })   
})
let aboutm=document.querySelector("nav .aboutm")
aboutm.addEventListener('click',function(){
	let wid = window.innerHeight
    window.scrollTo({
        top: wid
        , behavior: 'smooth'
    }) 
})
let qiuzhi=document.querySelector("nav .qiuzhi")
qiuzhi.addEventListener('click',function(){
	let wid = window.innerHeight
    window.scrollTo({
        top: 2*wid
        , behavior: 'smooth'
    }) 
})
let zuopin=document.querySelector("nav .zuopin")
zuopin.addEventListener('click',function(){
	let wid = window.innerHeight
    window.scrollTo({
        top: 3*wid+100
        , behavior: 'smooth'
    }) 
})
let jishu=document.querySelector("nav .jishu")
jishu.addEventListener('click',function(){
	let wid = window.innerHeight
    window.scrollTo({
        top: 4*wid+160
        , behavior: 'smooth'
    }) 
})
let jingli=document.querySelector("nav .jingli")
jingli.addEventListener('click',function(){
	let wid = window.innerHeight
    window.scrollTo({
        top: 5*wid+200
        , behavior: 'smooth'
    }) 
})
let lianxi=document.querySelector("nav .lianxi")
lianxi.addEventListener('click',function(){
	let wid = window.innerHeight
    window.scrollTo({
        top: 6*wid+200
        , behavior: 'smooth'
    }) 
})


window.onscroll = function () {
    let wid=window.innerHeight
    let nav=document.querySelector("nav")
    let nava=document.querySelectorAll("nav .ner li a") 
    let ahu=document.querySelector(".about .box h1")
    let nv=document.querySelector(".about .box .xi")
    let nn=document.querySelector(".about .box .user img")
    let na=document.querySelector(".about .box p")
    let piwang=document.querySelector(".piwang .box .xi")
    let piaw=document.querySelector(".piwang .box h1")
	let athor=document.querySelector(".athor .box .xi")
    let ahor=document.querySelector(".athor .box h1")
	let ad=document.querySelector(".jishu .box .xi")
    let ab=document.querySelector(".jishu .box h1")
	let as=document.querySelector(".jingli .box .xi")
    let ax=document.querySelector(".jingli .box h1")
	let aa=document.querySelector(".lianxi .box .xi")
    let aq=document.querySelector(".lianxi .box h1")
	let alla=document.querySelectorAll("nav ul a")
    if (document.body.scrollTop > wid-30 || document.documentElement.scrollTop > wid-30) {
        nav.classList.add("active") 
        ahu.classList.add("active") 
        nv.classList.add("active") 
        nn.classList.add("active") 
        na.classList.add("active")
		for(let i=0;i<alla.length;i++){
			alla[i].classList.remove("active")
		}
		let aboutm=document.querySelector("nav .aboutm")
		aboutm.classList.add("active")
    }else{
        nav.classList.remove("active")
         
    }
	if(document.body.scrollTop > 2*wid-30 || document.documentElement.scrollTop > 2*wid-30){ 
		piwang.classList.add("active")
		piaw.classList.add("active")
		for(let i=0;i<alla.length;i++){
			alla[i].classList.remove("active")
		}
		let aboutm=document.querySelector("nav .qiuzhi")
		aboutm.classList.add("active")
	}
	if(document.body.scrollTop > 3*wid-30 || document.documentElement.scrollTop > 3*wid-30){ 
		athor.classList.add("active")
		ahor.classList.add("active")
		for(let i=0;i<alla.length;i++){
			alla[i].classList.remove("active")
		}
		let aboutm=document.querySelector("nav .zuopin")
		aboutm.classList.add("active")
		let aboum=document.querySelector(".athor .zuopin")
		aboum.classList.add("active")
	}
	if(document.body.scrollTop > 4*wid-30 || document.documentElement.scrollTop > 4*wid-30){ 
		ad.classList.add("active")
		ab.classList.add("active")
		let aboutm=document.querySelector("nav .jishu")
		aboutm.classList.add("active")
		let abotm=document.querySelector(".content .jishu .jif")
		abotm.classList.add("active")
		let hua=document.querySelector(".content .jishu .jif .col:nth-child(1) .clip .left") 
		hua.classList.add("one")
		let hua1=document.querySelector(".content .jishu .jif .col:nth-child(2) .clip .left") 
		hua1.classList.add("one")
		let hua2=document.querySelector(".content .jishu .jif .col:nth-child(3) .clip .left") 
		hua2.classList.add("one")
		let hua3=document.querySelector(".content .jishu .jif .col:nth-child(4) .clip .left") 
		hua3.classList.add("one")
		for(let i=0;i<alla.length;i++){
			alla[i].classList.remove("active") 
		}
		
	}
	if(document.body.scrollTop > 5*wid-30 || document.documentElement.scrollTop > 5*wid-30){ 
		as.classList.add("active")
		ax.classList.add("active")
		for(let i=0;i<alla.length;i++){
			alla[i].classList.remove("active")
		}
		let aboutm=document.querySelector("nav .jingli")
		aboutm.classList.add("active")
		let abtm=document.querySelector(".content .jingli ul")
		abtm.classList.add("active")
	}
	if(document.body.scrollTop > 5.5*wid-30 || document.documentElement.scrollTop > 5.5*wid-30){ 
		aa.classList.add("active")
		aq.classList.add("active")
		let atm=document.querySelectorAll(".lianxi .box p")
		for(let f=0;f<atm.length;f++){
			atm[f].classList.add("active")
		}
		for(let i=0;i<alla.length;i++){
			alla[i].classList.remove("active")
			
		}
		let aboutm=document.querySelector(".content .jingli ul")
		aboutm.classList.add("active")
		
	}
}
